package cn.taketoday.live.config;

import java.util.Map;
import java.util.Vector;
import java.util.concurrent.ConcurrentHashMap;

import cn.taketoday.live.client.WebSocketProxy;
import cn.taketoday.live.data.Gift;
import cn.taketoday.live.data.RoomGift;
import cn.taketoday.live.data.UserBarrageMsg;
import cn.taketoday.live.data.user.User;
import cn.taketoday.live.data.user.UserCookie;
import cn.taketoday.live.data.user.UserManager;
import cn.taketoday.live.thread.AdvertThread;
import cn.taketoday.live.thread.FollowShieldThread;
import cn.taketoday.live.thread.GiftShieldThread;
import cn.taketoday.live.thread.LogThread;
import cn.taketoday.live.thread.ParseThankGiftThread;
import cn.taketoday.live.thread.WelcomeShieldThread;
import cn.taketoday.live.thread.core.HeartByteThread;
import cn.taketoday.live.thread.core.ReConnThread;
import cn.taketoday.live.thread.online.HeartBeatThread;
import cn.taketoday.live.thread.online.HeartBeatsThread;
import cn.taketoday.live.thread.online.SmallHeartThread;
import cn.taketoday.live.thread.online.UserOnlineHeartThread;

/**
 * @author BanqiJane
 */
public class GlobalData {
  //url 直播弹幕websocket地址
  public static String WebSocketURL = "wss://broadcastlv.chat.bilibili.com:2245/sub";
  //房间号
  public static Long ROOM_ID = null;
  //短号
  public static Integer SHORT_ROOM_ID = null;
  //主播uid
  public static Long AU_ID = null;
  //主播粉丝数
  public static Long FAN_SNUM = null;
  //主播名称
  public static String ANCHOR_NAME = null;
  //房间人气
  public static Long ROOM_POPULARITY = 1L;
  //直播状态 0不直播 1直播 2轮播
  public static Short lIVE_STATUS = 0;
  //cookie String串
  public static String USERCOOKIE = null;
  //user信息
  public static User USER = null;
  //cookie
  public static UserCookie COOKIE = null;
  //user弹幕长度
  public static UserBarrageMsg USER_BARRAGE_MESSAGE = null;
  //user房间管理信息
  public static UserManager USERMANAGER = null;
  //天选礼物屏蔽
  public static String SHIELDGIFTNAME = null;
  //天选是否正在屏蔽关注
  public static boolean IS_SHIELD_FOLLOW = false;
  //天选是否正在屏蔽欢迎
  public static boolean IS_SHIELD_WELCOME = false;
  //设置
  public volatile static CenterSetConfig centerSetConf;

  //心跳包 16进制
  public final static String heartByte = "0000001f0010000100000002000000015b6f626a656374204f626a6563745d";
  //包头长
  public final static char packageHeadLength = 16;
  //验证包协议类型
  public final static int firstPackageType = 7;
  //心跳包协议类型
  public final static int heartPackageType = 2;
  //心跳包&验证包协议版本
  public final static char packageVersion = 1;
  //心跳包&验证包的尾巴其他
  public final static int packageOther = 1;

  //websocket客户端主线程
  public static WebSocketProxy webSocketProxy;
  //心跳线程
  public static HeartByteThread heartByteThread;
  //重新连接线程
  public static ReConnThread reConnThread;
  //礼物感谢集
  public final static Map<String, Vector<Gift>> thankGiftConcurrentHashMap = new ConcurrentHashMap<>(3000);
  //待发弹幕集
//  public final static Vector<String> barrageString = new Vector<>();
  //log日志待写入集合
  public final static Vector<String> logString = new Vector<>(100);
  //待发送感谢关注集合
//  public final static Vector<Interact> interacts = new Vector<Interact>(200);
  //待发送欢迎进入直播间集合
//  public final static Vector<Interact> interactWelcome = new Vector<>(400);
  //自动回复处理弹幕
//  public final static Vector<AutoReply> replies = new Vector<>();

  //日志线程
  public static LogThread logThread;
  //处理感谢关注线程
//  public static ParseThankFollowThread parsethankFollowThread = new ParseThankFollowThread();
  //广告姬线程
  public static AdvertThread advertThread;
  //感谢礼物数据集线程
  public static ParseThankGiftThread parsethankGiftThread = new ParseThankGiftThread();
  //发送弹幕线程
//  public static SendBarrageThread sendBarrageThread;
  //屏蔽天选礼物线程
  public static GiftShieldThread giftShieldThread = new GiftShieldThread();
  //屏蔽天选关注线程
  public static FollowShieldThread followShieldThread = new FollowShieldThread();
  //屏蔽天选欢迎线程
  public static WelcomeShieldThread welcomeShieldThread = new WelcomeShieldThread();
  //自动回复线程
//  public static AutoReplyThread autoReplyThread;

  //用户在线线程集
  public static HeartBeatThread heartBeatThread;
  public static HeartBeatsThread heartBeatsThread;
  public static UserOnlineHeartThread userOnlineHeartThread;
  //小心心线程
  public static SmallHeartThread smallHeartThread;
  //签到线程

  //是否显示人气
  public static Boolean IS_ROOM_POPULARITY = false;

  //task
//	public static SchedulingRunnableUtil dosigntask = null;

  public static Long ROOMID_SAFE = null;
  public static String SMALLHEART_ADRESS = null;
  public static boolean is_sign = false;
  public static String EDITION = "2.4.4";

  //view
  //房间礼物集合
  public static Map<Integer, RoomGift> roomGiftConcurrentHashMap = new ConcurrentHashMap<Integer, RoomGift>(300);

  public static void setWebSocketProxy(WebSocketProxy webSocketProxy) {
    GlobalData.webSocketProxy = webSocketProxy;
  }
}
